package sbp.modelos;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table
public class Pratica implements java.io.Serializable{
	
	private static final long serialVersionUID = -4520132121754663164L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="cod_pratica")
	private Integer pratica;
	
	@ManyToOne
	@JoinColumn(name="cod_usuario")
	private Usuario usuario;
	@Embedded
	private Identificacao identificacao;
	@Embedded
	private Informacao informacao;
	@Embedded
	private Descricao descricao;
	
	public Pratica() {
	}
	
	public Pratica(Usuario usuario) {
		this.usuario = usuario;
	}
	
	public Identificacao getIdentificacao() {
		return identificacao;
	}
	public void setIdentificacao(Identificacao identificacao) {
		this.identificacao = identificacao;
	}
	public Informacao getInformacao() {
		return informacao;
	}
	public void setInformacao(Informacao informacao) {
		this.informacao = informacao;
	}
	public Descricao getDescricao() {
		return descricao;
	}
	public void setDescricao(Descricao descricao) {
		this.descricao = descricao;
	}
	public Usuario getUsuario() {
		return usuario;
	}
	public void setUsuario(Usuario usuario) {
		this.usuario = usuario;
	}
	public Integer getPratica() {
		return pratica;
	}
	public void setPratica(Integer pratica) {
		this.pratica = pratica;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((pratica == null) ? 0 : pratica.hashCode());
		result = prime * result + ((usuario == null) ? 0 : usuario.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Pratica other = (Pratica) obj;
		if (pratica == null) {
			if (other.pratica != null)
				return false;
		} else if (!pratica.equals(other.pratica))
			return false;
		if (usuario == null) {
			if (other.usuario != null)
				return false;
		} else if (!usuario.equals(other.usuario))
			return false;
		return true;
	}
	

	
	

}
